﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using XukaShop.Dao;
using XukaShop.Models.Entities;

namespace XukaShop.Biz
{
    public class PromotionBiz
    {
        private PromotionDao _promotionDao = new PromotionDao();

        /// <summary>
        /// Get List Promotion in Database
        /// </summary>
        /// <returns></returns>
        public List<Promotion> GetListPromotions()
        {
            return _promotionDao.GetListPromotions();
        }

        /// <summary>
        /// Get a Promotion by Id
        /// </summary>
        /// <param name="brandId"></param>
        /// <returns></returns>
        public Promotion GetPromotionById(int promotionId)
        {
            return _promotionDao.GetPromotionById(promotionId);
        }

        /// <summary>
        /// Get a Promotion by Name
        /// </summary>
        /// <param name="brandId"></param>
        /// <returns></returns>
        public Promotion GetPromotionByName(string promotionName)
        {
            return _promotionDao.GetPromotionByName(promotionName);
        }

        /// <summary>
        /// Get list status of promotion
        /// </summary>
        /// <returns></returns>
        public List<PromotionStatus> GetListPromotionStatus()
        {
            return _promotionDao.GetListPromotionStatus();
        }

        /// <summary>
        /// Save Promotion information
        /// </summary>
        /// <param name="productEnt"></param>
        /// <param name="isUpdate"></param>
        /// <returns></returns>
        public bool SavePromotion(Promotion promotionEnt, bool isUpdate)
        {
            if (isUpdate)
            {
                return this.EditPromotion(promotionEnt);
            }
            return this.CreatePromotion(promotionEnt);
        }

        /// <summary>
        /// Edit a Promotion
        /// </summary>
        /// <param name="brandModel"></param>
        /// <returns></returns>
        public bool EditPromotion(Promotion promotionModel)
        {
            return _promotionDao.EditPromotion(promotionModel);
        }

        /// <summary>
        /// Create a Promotion
        /// </summary>
        /// <param name="brandModel"></param>
        /// <returns></returns>
        public bool CreatePromotion(Promotion promotionModel)
        {
            return _promotionDao.CreatePromotion(promotionModel);
        }

        /// <summary>
        /// Delete a Promotion
        /// </summary>
        /// <param name="brandId"></param>
        /// <returns>Id of Promotion</returns>
        public bool DeletePromotion(int promotionId)
        {
            return _promotionDao.DeletePromotion(promotionId);
        }
    }
}